<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>办理退网服务</title>
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery-2.1.0.min.js"></script>
    <script>
        function confirmCancel() {
            const cardNumber = $('#card_number').text();
            if (confirm("是否要注销该卡号 ${cardNumber}！注销后不可再找回！")) {
                $.ajax({
                    url: '${pageContext.request.contextPath}/user/cancel',
                    type: 'POST',
                    data: { card_number: cardNumber },
                    success: function(response) {
                        alert('卡号已注销，您已退出登录');
                        window.location.href = '${pageContext.request.contextPath}/user/userLogin';
                    },
                    error: function() {
                        alert('注销失败，请稍后重试');
                    }
                });
            }
        }
    </script>
    <style>
        body {
            background: linear-gradient(135deg, #f0f6fc 0%, #d4e3fc 100%);
            min-height: 100vh;
            font-family: 'Microsoft YaHei', sans-serif;
        }
        .container {
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(26,77,140,0.08);
        }
        .card-number {
            font-size: 1.2rem;
            font-weight: bold;
            margin-bottom: 20px;
        }
        .btn-danger {
            background: linear-gradient(135deg, #B32222, #FFEF61);
            border: none;
            color: white;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
        }
        .btn-danger:hover {
            background: #FFEF61;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>🚪办理退网服务</h2>
        <p>当前卡号: ${cardNumber }</p>
        <button class="btn-danger" onclick="confirmCancel()">注销卡号</button>
    </div>
</body>
</html>